package com.guigu.www.denghao.controller;

import com.guigu.www.denghao.service.DHQuestionService;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.pojo.Question;
import com.guigu.www.pojo.Rubric;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/DHQuestionController")
public class DHQuestionController {

    @Autowired
    private DHQuestionService dhQuestionService;

    @PostMapping("/initQues")
    public PageVo<Question> initQues(Integer pageNum,Integer pageSize,String quesType,String quesName,String quesId){
        return dhQuestionService.initQues(pageNum,pageSize,quesId,quesName,quesType);
    }

    @PostMapping("/addQues")
    public Integer addQues(@RequestBody Question question, Integer [] questionDetails){
        dhQuestionService.addQues(question,questionDetails);
        return 0;
    }

    @PostMapping("/watchQues")
    public List<Rubric> watchQues (Integer quesId){
        return dhQuestionService.watchQues(quesId);
    }

    @PostMapping("/findByTestType")
    public List<Rubric> findByTestType(Integer quesTestType){
        return dhQuestionService.findByTestType(quesTestType);
    }

    @PostMapping("/clickRubType")
    public List<Question> clickRubType(Integer quesTestType){
        return dhQuestionService.clickRubType(quesTestType);
    }

    @PutMapping("/updateQuesId")
    public Integer updateQuesId(Integer quesId,Integer quesState){
        return dhQuestionService.updateQuesId(quesId,quesState);
    }
}
